// 常用方式
import http from "http"
import {
	renderHTML
} from "./modules/renderHTML.js"

// 路由路径列表
var arr = ["/a", '/b', '/c']

const serve = http.createServer()

// 事件监听
serve.on("request", (req, res) => {
	res.writeHead(200, {
		"Content-Type": "text/html;charset=utf-8"
	})
	res.write(renderHTML(req.url))
	res.end()
})

serve.listen(3000, () => {
	console.log("server start")
})


// 返回响应状态码
function renderState(url, arr) {
	return arr.includes(url) ? 200 : 404
}
